//
//  AppConfig.m
//  安好
//
//  Created by qinlongqing on 14-9-10.
//  Copyright (c) 2014年 冯凯. All rights reserved.
//

#import "AppConfig.h"
#import "sys/utsname.h"

@implementation AppConfig


+ (CurrentDeviceType)currentDeviceString{
//  需要#import "sys/utsname.h"
    struct utsname systemInfo;
    uname(&systemInfo);
    NSString *deviceString = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
    
    if ([deviceString isEqualToString:@"iPhone3,1"]){
        return iPhone_4;
    }
    if ([deviceString isEqualToString:@"iPhone4,1"]){
        return iPhone_4S;
    }
    if ([deviceString isEqualToString:@"iPhone5,2"]){
        return iPhone_5;
    }
    if ([deviceString isEqualToString:@"iPhone6,2"]) {
        return iPhone_5s;
    }
    if ([deviceString isEqualToString:@"iPhone3,2"]){
        return Verizon_iPhone_4;
    }
    if ([deviceString isEqualToString:@"i386"]){
        return Simulator;
    }
    if ([deviceString isEqualToString:@"x86_64"]){
        return Simulator;
    }
    return 0;
}

+ (NSInteger)getShiLiTestScoreWithWordSize:(NSInteger)currentWordSize{
    switch (currentWordSize) {
        case 7:
            return 97;
            break;
        case 8:
            return 98;
            break;
        case 9:
            return 99;
            break;
        case 10:
            return 100;
            break;
        case 11:
            return 99;
            break;
        case 12:
            return 98;
            break;
        case 13:
            return 97;
            break;
        case 14:
            return 96;
            break;
        case 15:
            return 95;
            break;
        case 16:
            return 94;
            break;
        case 17:
            return 93;
            break;
        case 18:
            return 92;
            break;
        case 19:
            return 91;
            break;
        case 20:
            return 90;
            break;
        case 21:
            return 89;
            break;
        case 22:
            return 88;
            break;
        case 23:
            return 87;
            break;
        case 24:
            return 86;
            break;
        case 25:
            return 85;
            break;
        case 26:
            return 84;
            break;
        case 27:
            return 83;
            break;
        case 28:
            return 82;
            break;
        case 29:
            return 81;
            break;
        case 30:
            return 80;
            break;
            
        default:
            break;
    }
    return 0;
}

+ (CGFloat)getShiLiLevelWithWordSize:(NSInteger)currentWordSize{
    switch (currentWordSize) {
        case 7:
            return 5.3;
            break;
        case 8:
            return 5.2;
            break;
        case 9:
            return 5.1;
            break;
        case 10:
            return 5.0;
            break;
        case 11:
            return 4.9;
            break;
        case 12:
            return 4.8;
            break;
        case 13:
            return 4.7;
            break;
        case 14:
            return 4.6;
            break;
        case 15:
            return 4.5;
            break;
        case 16:
            return 4.4;
            break;
        case 17:
            return 4.3;
            break;
        case 18:
            return 4.2;
            break;
        case 19:
            return 4.1;
            break;
        case 20:
            return 4.0;
            break;
        case 21:
            return 3.9;
            break;
        case 22:
            return 3.8;
            break;
        case 23:
            return 3.7;
            break;
        case 24:
            return 3.6;
            break;
        case 25:
            return 3.5;
            break;
        case 26:
            return 3.4;
            break;
        case 27:
            return 3.3;
            break;
        case 28:
            return 3.2;
            break;
        case 29:
            return 3.1;
            break;
        case 30:
            return 3.0;
            break;
            
        default:
            break;
    }
    return 0.0;
}

+ (NSString *)getSeJueTestResultWithType:(SeJueTestResult)seJueTestResultType{
    switch (seJueTestResultType) {
        case zhengChang:
            return @"正常";
            break;
        case hongLvSeMang:
            return @"先天性红绿色盲（Ⅰ级）";
            break;
        case hongSeMangAndLvSeZhengChang:
            return @"先天性红色色盲（Ⅱ级）";
            break;
        case hongSeMangAndLvSeRuo:
            return @"先天性红色色盲绿色色弱（Ⅱ级）";
            break;
        case lvSeMangAndHongSeZhengChang:
            return @"先天性绿色色盲（Ⅱ级）";
            break;
        case lvSeMangAndHongSeRuo:
            return @"先天性绿色色盲红色色弱（Ⅱ级）";
            break;
        case hongSeRuoAndLvSeRuo:
            return @"先天性红绿色弱（Ⅲ级）";
            break;
        case hongSeRuoAndLvSeZhengChang:
            return @"先天性红绿色弱（Ⅲ级）";
            break;
        case hongSeZhengChangAndLvSeRuo:
            return @"先天性红绿色弱（Ⅲ级）";
            break;
        case hongSeZhengChangAndLvSeZhengChang_level3:
            return @"先天性色弱";
            break;
        case hongSeJiRuoAndLvSeJiRuo:
            return @"先天性红绿色弱（Ⅲ级）";
            break;
        case hongSeJiRuoAndLvSeZhengChang:
            return @"先天性红绿色弱（Ⅲ级）";
            break;
        case hongSeZhengChangAndLvSeJiRuo:
            return @"先天性红绿色弱（Ⅲ级）";
            break;
        case hongSeZhengChangAndLvSeZhengChang_level4:
            return @"先天性色弱";
            break;
        case houTianHongLvYiChangAndZiSeZhengChang:
            return @"后天性红绿色觉异常";
            break;
        case houTianHongLvZhengChangAndZiSeYiChang:
            return @"后天性紫色觉异常";
            break;
        case houTianHongLvAndZiSeKeNengYiChang:
            return @"可能后天性色觉异常";
            break;
        case quanSeMang:
            return @"全色盲";
            break;

        default:
            break;
    }
    return nil;
}

+ (NSString *)getXinLvTestResult:(NSInteger)testResult{
    if (testResult > 40 && testResult <= 60) {
        return @"心率过缓";
    }
    else if (testResult > 60 && testResult <= 100){
        return @"心率正常";
    }
    else if (testResult > 100){
        return @"心率过速";
    }
    return nil;
}

+ (NSString *)getXinLvPingYuWithTestResult:(NSInteger)testResult{
    if (testResult > 40 && testResult <= 50) {
        return @"有病理性窦性心动过缓的可能，请注意健康并尽快到正规医疗机构做心脏检查。";
    }
    else if (testResult > 50 && testResult <= 60) {
        return @"如果你经常体育锻炼且精力充沛，并无任何不妥，可以继续保持，但如果你较少参与体育锻炼，那么你就是心率过缓，请注意健康并尽快到正规医疗机构做心脏检查。";
    }
    else if (testResult > 60 && testResult <= 100){
        return @"你有一颗非常健康的心脏，请继续保持。";
    }
    else if (testResult > 100){
        return @"如果你刚做完剧烈运动或者有妊娠、兴奋、恐惧、激动、饮酒等任一情况，请深呼吸并静静休息一段时间，再做测量，如果你是在较为平静情况下做到的测试，则为心率过速，请注意健康并尽快到正规医疗机构做心脏检查。";
    }
    return nil;
}

+ (NSInteger)getFistTestScoreWithTestCount:(NSInteger)fistedCount{
    if (fistedCount == 0) {
        return 0;
    }
    else if (fistedCount > 0 && fistedCount <= 3){
        return 10;
    }
    else if (fistedCount > 3 && fistedCount <= 5) {
        return 20;
    }
    else if (fistedCount > 5 && fistedCount <= 10){
        return 30;
    }
    else if (fistedCount > 10 && fistedCount <= 15){
        return 40;
    }
    else if (fistedCount > 15 && fistedCount <= 20){
        return 50;
    }
    else if (fistedCount > 20 && fistedCount <= 25){
        return 60;
    }
    else if (fistedCount > 25 && fistedCount <= 30){
        return 70;
    }
    else if (fistedCount > 30 && fistedCount <= 35){
        return 80;
    }
    else if (fistedCount > 35 && fistedCount <= 40){
        return 85;
    }
    else if (fistedCount > 40 && fistedCount <= 45){
        return 90;
    }
    else if (fistedCount > 45 && fistedCount < 50){
        return 95;
    }
    else if (fistedCount >= 50){
        return 100;
    }
    return 0;
}
+ (NSString *)getFistPingYuWithTestCount:(NSInteger)fistedCount{
    if (fistedCount > 0 && fistedCount <= 25) {
        return @"拳手级表现，继续操练";
    }
    else if (fistedCount > 25 && fistedCount <= 45){
        return @"拳王级表现，臂力惊人";
    }
    else if (fistedCount > 45){
        return @"拳皇级表现，极限冲击";
    }
    return nil;
}

+ (NSInteger)getSupplenessTestScoreWithTestKeepedTime:(CGFloat)fistTestResult{
    if (fistTestResult >0 && fistTestResult <= 10) {
        return 10;
    }
    else if (fistTestResult > 10 && fistTestResult <= 20){
        return 20;
    }
    else if (fistTestResult > 20 && fistTestResult <= 30){
        return 30;
    }
    else if (fistTestResult > 30 && fistTestResult <= 40){
        return 40;
    }
    else if (fistTestResult > 40 && fistTestResult <= 50){
        return 50;
    }
    else if (fistTestResult > 50 && fistTestResult <= 60){
        return 60;
    }
    else if (fistTestResult > 60 && fistTestResult <= 80){
        return 70;
    }
    else if (fistTestResult > 80 && fistTestResult <= 100){
        return 80;
    }
    else if (fistTestResult > 100 && fistTestResult <= 120){
        return 90;
    }
    else if (fistTestResult > 120 && fistTestResult <= 130){
        return 92;
    }
    else if (fistTestResult > 130 && fistTestResult <= 140){
        return 94;
    }
    else if (fistTestResult > 140 && fistTestResult <= 160){
        return 96;
    }
    else if (fistTestResult > 160 && fistTestResult <= 180){
        return 98;
    }
    else if (fistTestResult > 180){
        return 100;
    }
    return 0;
}
+ (NSString *)getSupplenessPingYuWithTestKeepedTime:(CGFloat)fistTestResult{
    if (fistTestResult > 0 && fistTestResult <= 60) {
        return @"红色段位，你的身体有些僵硬哦";
    }
    else if (fistTestResult > 60 && fistTestResult <= 120){
        return @"白色段位，只差一点就够优秀，继续努力";
    }
    else if (fistTestResult > 120){
        return @"金色段位，请继续保持你惊人的柔韧性";
    }
    return nil;
}


@end
